package com.example.examoj.service;

import com.example.examoj.dao.Problem;
import com.example.examoj.dao.ProblemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProblemService {
    @Autowired
    public ProblemMapper problemMapper;

    public void insert(Problem problem) {
        problemMapper.insertOneProblem(problem);
    }

    public List<Problem> selectAll() {
        return problemMapper.selectAllProblem();
    }

    public Problem selectOne(int id) {
        return problemMapper.selectOneProblemById(id);
    }

    public void delete(int id) {
        problemMapper.deleteProblemById(id);
    }
}
